
import { Switch } from "antd";
import EditMaterial from "../../../";
import React from "react";

export default function VisibleItem() {

    const controller = EditMaterial.useController();

    const material = controller.useMemo(s => s.material, []);

    const onChange = React.useCallback((e: boolean) => {
        if (!material) return;

        material.visible = e;
        controller.onChange(material);
    }, [controller, material])

    if (!material) return <></>

    return (
        <Switch onChange={onChange} size="small" checked={material.visible} />
    )
}